#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: solution.py 
@version:
@time: 2024/01/21 
"""


def main():
    input_string = input()
    nums_string = input_string.split()

    nums = [int(num) for num in nums_string]

    left = []
    right = []

    for num in nums:
        if num > 0:
            right.append(num)
        else:
            left.append(abs(num))

        while left and right:
            if left[-1] > right[-1]:
                left.append(left.pop() - right.pop())
            elif left[-1] < right[-1]:
                right.append(right.pop() - left.pop())
            else:
                left.pop()
                right.pop()

    print(len(left) + len(right))


if __name__ == "__main__":
    """
```text
5 10 8 -8 -5
```

ouput

```text
2
```    
    """
    main()
